package com.yuke.cloud.service.uac.service;

import com.yuke.cloud.common.base.dto.LoginAuthDto;
import com.yuke.cloud.service.uac.dto.BindUserRolesDto;
import com.yuke.cloud.service.uac.dto.RoleBindUserDto;
import com.yuke.cloud.service.uac.dto.RoleBindUserReqDto;
import com.yuke.cloud.service.uac.dto.UserRoleDto;
import com.yuke.cloud.service.uac.entity.AccUserRole;
import com.yuke.cloud.common.core.support.IService;
import com.yuke.cloud.service.uac.vo.UserBindRoleVo;

import java.util.List;


/**
 * Created by wg on 2018/09/15.
 */
public interface AccUserRoleService extends IService<AccUserRole> {

    int deleteUserRoleByUserId(Long userId);
    List<UserRoleDto> selectUserRoleInfoByUserId(Long userId);

    /**
     * List super user list.
     *
     * @param superManagerRoleId the super manager role id
     *
     * @return the list
     */
    List<Long> listSuperUser(Long superManagerRoleId);

    /**
     * 根据角色信息查询用户ID集合.
     *
     * @param roleId the role id
     *
     * @return the list
     */
    List<AccUserRole> listByRoleId(Long roleId);

    /**
     * 根据角色ID解除关联关系.
     *
     * @param roleId the role id
     */
    void deleteByRoleId(Long roleId);

    /**
     * 根据角色ID列表查询用户ID集合.
     *
     * @param idList the id list
     *
     * @return the list
     */
    List<AccUserRole> listByRoleIdList(List<Long> idList);

    /**
     * 根据角色ID集合解除关联关系.
     *
     * @param roleIdList the role id list
     */
    void deleteByRoleIdList(List<Long> roleIdList);

    /**
     * 角色绑定用户获取穿梭框信息.
     *
     * @param roleId        the role id
     * @param currentUserId the current user id
     *
     * @return the role bind user dto by role id
     */
    RoleBindUserDto getRoleBindUserDto(Long roleId, Long currentUserId);

    /**
     * 角色绑定用户.
     *
     * @param roleBindUserReqDto the role bind user req dto
     * @param loginAuthDto       the login auth dto
     */
    void bindUser4Role(RoleBindUserReqDto roleBindUserReqDto, LoginAuthDto loginAuthDto);

    /**
     * Delete exclude super mng.
     *
     * @param roleId             the role id
     * @param superManagerRoleId the super manager role id
     */
    void deleteExcludeSuperMng(Long roleId, Long superManagerRoleId);

    /**
     * 保存用户角色中间表信息.
     *
     * @param userId the user id
     * @param roleId the role id
     *
     * @return the int
     */
    int saveRoleUser(Long userId, Long roleId);

    /**
     * 用户是否绑定该角色.
     *
     * @param userId the user id
     * @param roleId the role id
     *
     * @return the by user id and role id
     */
    AccUserRole getByUserIdAndRoleId(Long userId, Long roleId);

    /**
     * 获取绑定的角色信息.
     *
     * @param userId the user id
     *
     * @return the user bind role dto
     */
    UserBindRoleVo getUserBindRoleDto(Long userId);

    /**
     * 根据用户ID查询集合.
     *
     * @param userId the user id
     *
     * @return the list
     */
    List<AccUserRole> listByUserId(Long userId);

    /**
     * 绑定用户角色信息.
     *
     * @param bindUserRolesDto the bind user roles dto
     * @param loginAuthDto     the login auth dto
     */
    void bindUserRoles(BindUserRolesDto bindUserRolesDto, LoginAuthDto loginAuthDto);

    /**
     * 根据用户ID解除用户角色关联.
     *
     * @param userId the user id
     *
     * @return the int
     */
    int deleteByUserId(Long userId);

    /**
     * 判断某一个用户是否是超级管理员角色
     * @return
     */
    Boolean checkAdminByUserId(Long userId);
    Boolean checkAdminByLoginName(String loginName);

    Long generateUserRoleId();
}
